<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HEAD>
 <TITLE>知恵袋　q10114739705　チェックボックス　セレクトボックス連動</TITLE>
        <META http-equiv="X-UA-Compatible"     content="IE=8">
        <META http-equiv="Content-Type"        content="text/html; charset=UTF-8">
        <META http-equiv="Content-Script-Type" content="text/javascript">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
// Checkbox Function
function Cbox_func(Form_names,names){
 var Cbox_obj   = eval('document.'+Form_names+'.elements["'+names+'"]');
 var Cbox_value, Cbox_check;
  if(Cbox_obj.checked){
   Cbox_check   = "1";
  }else{
   Cbox_check   = "0";
  }
  Cbox_value = Cbox_obj.value;
return {Cbox_check:Cbox_check,Cbox_value:Cbox_value};
}
// SelectBox Function
function Sbox_disable(Form_names,names,disables){
 var Sbox_obj   = eval('document.'+Form_names+'.'+names);
 if(disables=="OK"){
  Sbox_obj.disabled=false;
 }else{
  Sbox_obj.disabled=true;
 }
}

function checkbox_chg(){
 if(Cbox_func("form1","checkbox1").Cbox_check=="1"){
  Sbox_disable("form1","SEL1","OK");
  Sbox_disable("form1","SEL2","OK");
 }else{
  Sbox_disable("form1","SEL1","NG");
  Sbox_disable("form1","SEL2","NG");
 }
}
</script>
<style type="text/css">
body{background-color:#000000;color:#ffffff;font-size:12px;}
</style>
</head>
<body>
<form name="form1">
<input type="checkbox" name="checkbox1" value="1" onChange="checkbox_chg()">
<select name="SEL1">
	<option value="AAA">AAA</option>
	<option value="BBB">BBB</option>
</select>
<select name="SEL2">
	<option value="CCC">CCC</option>
	<option value="DDD">DDD</option>
</select>

</form>
</body>
</HTML>

